﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using tantrinh.Models;

namespace tantrinh.Controllers
{
    public class HomeController : Controller
    {
        private TanTrinhContext db = new TanTrinhContext();
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            var queryResults1 = db.SanPham.Where(p => p.TinhTrang == true);
            var model = new HomeView
            {
                ChiTietDanhMuc = db.ChiTietDanhMuc.ToList(),
                SanPham=queryResults1.ToList()
            };
            return View(model);
        }

        public ActionResult About()
        {
            return View();
        }
        public ActionResult Admin()
        {
            return View();
        }
    }
}
